package com.dianping.cat.home.dependency.config.entity;

import com.dianping.cat.home.dependency.config.BaseEntity;
import com.dianping.cat.home.dependency.config.IVisitor;
import java.util.LinkedHashMap;
import java.util.Map;

public class TopologyGraphConfig
  extends BaseEntity<TopologyGraphConfig> {
/*  10 */   private Map<String, NodeConfig> m_nodeConfigs = new LinkedHashMap();

/*  12 */   private Map<String, EdgeConfig> m_edgeConfigs = new LinkedHashMap();






/*  19 */   public void accept(IVisitor visitor) { visitor.visitTopologyGraphConfig(this); }


  public TopologyGraphConfig addEdgeConfig(EdgeConfig edgeConfig) {
/*  23 */     this.m_edgeConfigs.put(edgeConfig.getKey(), edgeConfig);
    return this;
  }

  public TopologyGraphConfig addNodeConfig(NodeConfig nodeConfig) {
/*  28 */     this.m_nodeConfigs.put(nodeConfig.getType(), nodeConfig);
    return this;
  }


  public boolean equals(Object obj) {
/*  34 */     if (obj instanceof TopologyGraphConfig) {
/*  35 */       TopologyGraphConfig _o = (TopologyGraphConfig)obj;

/*  37 */       if (!equals(getNodeConfigs(), _o.getNodeConfigs())) {
/*  38 */         return false;
      }

/*  41 */       if (!equals(getEdgeConfigs(), _o.getEdgeConfigs())) {
/*  42 */         return false;
      }


/*  46 */       return true;
    }

/*  49 */     return false;
  }


/*  53 */   public EdgeConfig findEdgeConfig(String key) { return (EdgeConfig)this.m_edgeConfigs.get(key); }



/*  57 */   public NodeConfig findNodeConfig(String type) { return (NodeConfig)this.m_nodeConfigs.get(type); }


  public EdgeConfig findOrCreateEdgeConfig(String key) {
/*  61 */     EdgeConfig edgeConfig = (EdgeConfig)this.m_edgeConfigs.get(key);

/*  63 */     if (edgeConfig == null) {
/*  64 */       synchronized (this.m_edgeConfigs) {
/*  65 */         edgeConfig = (EdgeConfig)this.m_edgeConfigs.get(key);

/*  67 */         if (edgeConfig == null) {
/*  68 */           edgeConfig = new EdgeConfig(key);
/*  69 */           this.m_edgeConfigs.put(key, edgeConfig);
        }
      }
    }

/*  74 */     return edgeConfig;
  }

  public NodeConfig findOrCreateNodeConfig(String type) {
    NodeConfig nodeConfig = (NodeConfig)this.m_nodeConfigs.get(type);

/*  80 */     if (nodeConfig == null) {
/*  81 */       synchronized (this.m_nodeConfigs) {
/*  82 */         nodeConfig = (NodeConfig)this.m_nodeConfigs.get(type);

/*  84 */         if (nodeConfig == null) {
/*  85 */           nodeConfig = new NodeConfig(type);
/*  86 */           this.m_nodeConfigs.put(type, nodeConfig);
        }
      }
    }

/*  91 */     return nodeConfig;
  }


  public Map<String, EdgeConfig> getEdgeConfigs() { return this.m_edgeConfigs; }



/*  99 */   public Map<String, NodeConfig> getNodeConfigs() { return this.m_nodeConfigs; }



  public int hashCode() {
/* 104 */     int hash = 0;

/* 106 */     hash = hash * 31 + ((this.m_nodeConfigs == null) ? 0 : this.m_nodeConfigs.hashCode());
/* 107 */     return hash * 31 + ((this.m_edgeConfigs == null) ? 0 : this.m_edgeConfigs.hashCode());
  }




  public void mergeAttributes(TopologyGraphConfig other) {}



/* 117 */   public EdgeConfig removeEdgeConfig(String key) { return (EdgeConfig)this.m_edgeConfigs.remove(key); }



/* 121 */   public NodeConfig removeNodeConfig(String type) { return (NodeConfig)this.m_nodeConfigs.remove(type); }
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/classes/!/com/dianping/cat/home/dependency/config/entity/TopologyGraphConfig.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */